package org.lql.algo.codecrush.week008;

/**
 * @author: liangqinglong
 * @date: 2025-08-19 00:03
 * @description: 136. 只出现一次的数字 <a href="https://leetcode.cn/problems/single-number/description/">...</a>
 **/
public class SingleNumber {

	public int singleNumber(int[] nums) {
		int ans = 0;
		for (int num : nums) {
			ans ^= num;
		}
		return ans;
	}

	public static void main(String[] args) {
		int[] nums = new int[]{4, 1, 2, 1, 2};
		SingleNumber singleNumber = new SingleNumber();
		System.out.println(singleNumber.singleNumber(nums));
	}
}
